﻿/* Copyright (c) 2010 EPiServer AB
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System.Web.UI.WebControls;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.Web.PropertyControls;

namespace EPiServer.Municipality.Web.UI.PropertyControls {
    /// <summary>
    /// PropertyControl implementation used for rendering PropertyDivider.cs data.
    /// </summary>
    public class PropertyDividerControl : PropertyDataControl {
        /* *******************************************************************
        * Properties
        * *******************************************************************/
        #region public override TableRowLayout RowLayout

        /// <summary>
        /// Gets the RowLayout of the PropertyDividerControl
        /// </summary>
        /// <value></value>
        public override TableRowLayout RowLayout {
            get { return TableRowLayout.Wide; }
        }

        #endregion

        /* *******************************************************************
        * Constructors
        * *******************************************************************/
        #region public PropertyDivider PropertyDivider

        /// <summary>
        /// Gets the PropertyDivider of the PropertyDividerControl
        /// </summary>
        /// <value></value>
        public PropertyDivider PropertyDivider {
            get { return PropertyData as PropertyDivider; }
        }

        #endregion

        /* *******************************************************************
        * Methods
        * *******************************************************************/
        #region public override void ApplyEditChanges()

        /// <summary>
        /// 
        /// </summary>
        public override void ApplyEditChanges() {
        }

        #endregion
        #region public override void CreateEditControls()

        /// <summary>
        /// 
        /// </summary>
        public override void CreateEditControls() {
            var literal = new Literal();
            literal.Text = "<table class=\"epistandardtable\" width=\"100%\"><tr><th>" + PropertyDivider.TranslateDividerDisplayName() +
                           "</th></tr></table>";
            Controls.Add(literal);
        }

        #endregion
    }
}